package com.henz.web.domain;

import java.util.HashMap;
import java.util.Map;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;


@PersistenceCapable(identityType=IdentityType.DATASTORE, detachable = "true")
public class HenzUser{
	public HenzUser() {
		super();
	}
	
	public HenzUser(Map<String, Object> userMap) {
		this.id                 = ( Long   ) userMap.get( "id"                 );
		setData(userMap);
	}
	
	//@NotPersistent
	//private static final long serialVersionUID = -3587070347719682048L;
	
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    /*
	@Persistent
	private String email;
	@Persistent
	private String firstName;
    @Persistent
	private String middleInitial;
    @Persistent
	private String lastName;
    @Persistent
	private Date   DOB;
    @Persistent
	private String gender;
    @Persistent
	private String address;
    @Persistent
	private String city;
    @Persistent
	private String street;
    @Persistent
	private String zip;
    @Persistent
	private String apartment;
    @Persistent
	private String insurance;
    @Persistent
	private String insuranceAccountNo;
    @Persistent
	private String organDonor;
    @Persistent
	private String phoneNum;
	*/
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
    /*
	
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getMiddleInitial() {
		return middleInitial;
	}
	public void setMiddleInitial(String middleInitial) {
		this.middleInitial = middleInitial;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public Date getDOB() {
		return DOB;
	}
	public void setDOB(Date dOB) {
		DOB = dOB;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	public String getZip() {
		return zip;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public String getApartment() {
		return apartment;
	}
	public void setApartment(String apartment) {
		this.apartment = apartment;
	}
	public String getInsurance() {
		return insurance;
	}
	public void setInsurance(String insurance) {
		this.insurance = insurance;
	}
	public String getInsuranceAccountNo() {
		return insuranceAccountNo;
	}
	public void setInsuranceAccountNo(String insuranceAccountNo) {
		this.insuranceAccountNo = insuranceAccountNo;
	}
	public String getOrganDonor() {
		return organDonor;
	}
	public void setOrganDonor(String organDonor) {
		this.organDonor = organDonor;
	}
	public String getPhoneNum() {
		return phoneNum;
	}
	public void setPhoneNum(String phoneNum) {
		this.phoneNum = phoneNum;
	}
	*/
	
	public void setData(Map<String, Object> userMap){
		/*
		this.email              = ( String ) userMap.get( "email"              );
		this.firstName          = ( String ) userMap.get( "firstName"          );
		this.middleInitial      = ( String ) userMap.get( "middleInitial"      );
		this.lastName           = ( String ) userMap.get( "lastName"           );
		this.DOB                = ( Date   ) userMap.get( "DOB"                );
		this.gender             = ( String ) userMap.get( "gender"             );
		this.address            = ( String ) userMap.get( "address"            );
		this.city               = ( String ) userMap.get( "city"               );
		this.street             = ( String ) userMap.get( "street"             );
		this.zip                = ( String ) userMap.get( "zip"                );
		this.apartment          = ( String ) userMap.get( "apartment"          );
		this.insurance          = ( String ) userMap.get( "insurance"          );
		this.insuranceAccountNo = ( String ) userMap.get( "insuranceAccountNo" );
		this.organDonor         = ( String ) userMap.get( "organDonor"         );
		this.phoneNum           = ( String ) userMap.get( "phoneNum"           );
		*/
	}
	
	public Map<String, Object> getUserMap(){
		
		Map<String, Object> userMap = new HashMap<String, Object>();
		
		userMap.put( "id"                , this.id                 );
		/*
		userMap.put( "email"             , this.email              );
		userMap.put( "firstName"         , this.firstName          );
		userMap.put( "middleInitial"     , this.middleInitial      );
		userMap.put( "lastName"          , this.lastName           );
		userMap.put( "DOB"               , this.DOB                );
		userMap.put( "gender"            , this.gender             );
		userMap.put( "address"           , this.address            );
		userMap.put( "city"              , this.city               );
		userMap.put( "street"            , this.street             );
		userMap.put( "zip"               , this.zip                );
		userMap.put( "apartment"         , this.apartment          );
		userMap.put( "insurance"         , this.insurance          );
		userMap.put( "insuranceAccountNo", this.insuranceAccountNo );
		userMap.put( "organDonor"        , this.organDonor         );
		userMap.put( "phoneNum"          , this.phoneNum           );
		*/
		return userMap;
	}
}
